package com.fantabest.console.client.widget;

import java.util.List;

import com.extjs.gxt.ui.client.data.BaseListLoader;
import com.extjs.gxt.ui.client.data.BeanModel;
import com.extjs.gxt.ui.client.data.BeanModelReader;
import com.extjs.gxt.ui.client.data.ListLoadResult;
import com.extjs.gxt.ui.client.data.RpcProxy;
import com.extjs.gxt.ui.client.util.Padding;
import com.extjs.gxt.ui.client.widget.ContentPanel;
import com.extjs.gxt.ui.client.widget.Layout;
import com.extjs.gxt.ui.client.widget.form.ComboBox;
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
import com.extjs.gxt.ui.client.widget.layout.VBoxLayout;
import com.extjs.gxt.ui.client.widget.layout.VBoxLayout.VBoxLayoutAlign;
import com.fantabest.common.entity.Season;
import com.google.gwt.user.client.rpc.AsyncCallback;

public class SeasonTopBar extends ContentPanel {

	private ComboBox<BeanModel> seasonCombo;

	public SeasonTopBar() {
		initUI();
	}

	public SeasonTopBar(Layout layout) {
		initUI();
	}

	private void initUI() {
		this.setLayout(new FitLayout());
		this.setStyleName("seasonTopBar");
		this.setHeaderVisible(false);
		this.setBodyBorder(false);

		VBoxLayout layout = new VBoxLayout();
		layout.setPadding(new Padding(10, 5, 5, 5));
		layout.setVBoxLayoutAlign(VBoxLayoutAlign.RIGHT);
		this.setLayout(layout);

		RpcProxy<List<Season>> proxy = new RpcProxy<List<Season>>() {
			public void load(Object loadConfig,
					AsyncCallback<List<Season>> callback) {
//				testservice.getData(callback);
			}
		};

		BeanModelReader reader = new BeanModelReader();

		BaseListLoader<ListLoadResult<BeanModel>> loader = new BaseListLoader<ListLoadResult<BeanModel>>(
				proxy, reader);
		loader.load();

	}

}
